package com.qiji.video.web.controller;

import com.qiji.video.bean.VideoType;
import com.qiji.video.service.ITypeService;
import com.qiji.video.util.Result;
import com.qiji.video.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 视频分类管理模块
 */
@Api(
        tags = {"视频类型模块"}
)
@RestController
@RequestMapping({"/auth/admin/video/type"})
public class TypeController {
    @Autowired
    private ITypeService iVideoTypeService;

    @ApiOperation("查询所有类型")
    @GetMapping("/queryAllType")
    public Result findAllVideoType(){
        List<VideoType> videoTypes = iVideoTypeService.selectAllType();
        return ResultUtil.success(videoTypes);
    }
    @ApiOperation("根据id删除类型")
    @DeleteMapping("/deleteTypeById")
    public Result deleteTypeById(Integer id){
        iVideoTypeService.deleteVideoType(id);
        return ResultUtil.success();
    }
    @ApiOperation("修改类型信息")
    @PostMapping("/updateType")
    public Result updateVideoType(VideoType videoType){
        iVideoTypeService.updateType(videoType);
        return ResultUtil.success();
    }
    @ApiOperation("添加类型信息")
    @PostMapping("/addType")
    public Result addVideoType(VideoType videoType){
        iVideoTypeService.addVideoType(videoType);
        return ResultUtil.success();
    }
}
